package com.cskaoyan.user.converter;

import com.cskaoyan.user.dal.entitys.Member;
import com.cskaoyan.user.dto.*;
import com.cskaoyan.user.form.UserRegisterRequest;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring")
public interface MemberConverter {

    @Mappings({})
    QueryMemberResponse member2Res(Member member);

    @Mappings({})
    Member updateReq2Member(UpdateMemberRequest request);

    /**
     * TODO: 注册转换
     * author: yepq2025@outlook.com
     * time: 2022-12-03 10:52:35
    */
    @Mappings({@Mapping(source = "userName",target = "username"),
            @Mapping(source = "userPwd",target = "password")})

    Member UserRegisterRequestToMember(UserRegisterRequest request);
    /**
     * TODO: 登录转换
     * author: yepq2025@outlook.com
     * time: 2022-12-03 10:52:55
     * @param request
     */
    @Mappings({@Mapping(source = "userName",target = "username"),
            @Mapping(source = "userPwd",target = "password")})
    Member UserLoginRequestToMember(UserRegisterRequest request);
    /**
     * TODO: 登录转换
     * author: yepq2025@outlook.com
     * time: 2022-12-03 10:53:16
    */
    UserLoginResponse userLoginResponseTOMember (Member member);

}
